package com.yc.bdw.Activity;

import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageView;

import com.yc.bdw.Adapter.AkeyOfWineGridViewAdapter;
import com.yc.bdw.R;
import com.yc.bdw.model.SituationItem;
import com.yc.bdw.Widget.MyGridView;

import org.kymjs.kjframe.KJActivity;
import org.kymjs.kjframe.ui.BindView;

import java.util.ArrayList;
import java.util.List;

public class AKeyOfWineActivity extends KJActivity {
    @BindView(id = R.id.akeyofwine_back, click = true)
    private ImageView backBtn;
    @BindView(id = R.id.akeyofwine_situations, click = true)
    private MyGridView situaions;

    private List<SituationItem> list = new ArrayList<SituationItem>();
    private AkeyOfWineGridViewAdapter adapter;

    @Override
    public void setRootView() {
        setContentView(R.layout.activity_akeyofwine);
    }

    @Override
    public void initData() {
        super.initData();

        init();

        adapter = new AkeyOfWineGridViewAdapter(aty);
        adapter.setList(list);
    }

    private void init() {
        SituationItem item = new SituationItem();
        item.setName("朋友聚会");
        list.add(item);

        SituationItem item1 = new SituationItem();
        item1.setName("礼节拜访");
        list.add(item1);

        SituationItem item2 = new SituationItem();
        item2.setName("朋友聚会");
        list.add(item2);

        SituationItem item3 = new SituationItem();
        item3.setName("女士专区");
        list.add(item3);

        SituationItem item4 = new SituationItem();
        item4.setName("小资生活");
        list.add(item4);

        SituationItem item5 = new SituationItem();
        item5.setName("婚庆用酒");
        list.add(item5);

        SituationItem item6 = new SituationItem();
        item6.setName("商务宴请");
        list.add(item6);
    }

    @Override
    public void initWidget() {
        super.initWidget();

        situaions = (MyGridView) findViewById(R.id.akeyofwine_situations);
        situaions.setAdapter(adapter);
        situaions.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                showActivity(aty,SelectorActivity.class);
            }
        });
    }

    @Override
    public void widgetClick(View v) {
        super.widgetClick(v);
        switch (v.getId()) {
            case R.id.akeyofwine_back:
                finish();
                break;
        }
    }
}
